package com.zhoushihao.class0807;

import java.util.Scanner;

public class SumFactorial {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int sum = 0;
        for (int i = 1; i <= n; i++) {
            sum += factorial(i);
        }
        System.out.println(sum);
    }
    public static int factorial(int n) {
        if (n == 1) {
            return 1;
        } else
            return n * factorial(n - 1);
    }
}
